<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/themes/admin/lib/layui/css/layui.css">
    <script src="/themes/admin/lib/layui/layui.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body style="background: #f1f1f1">
<div style="margin: 20px;padding:10px;background: #ffffff">
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱账户</label>
        <div class="layui-input-inline">
            <input type="text" name="value" value="{$smtp.value}" required  lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">邮箱账户</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="text" name="extend" value="{$smtp.extend}" required lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">邮箱密码</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">端口</label>
        <div class="layui-input-inline">
            <input type="text" name="intro" value="{$smtp.intro}" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">常规端口为25或587，若不能成功发送请在邮箱官网查询</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveSMTP">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</div>
<script>
    layui.use("layer");
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(saveSMTP)', function(data){
            $.ajax({
                type:"post",
                data:data.field,
                url:"/admin/system/smtp",
                success:function(e){
                    layer.msg(e.msg);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>